<template>
  <el-container style="height: 100%; border: 1px solid #eee">
    <el-aside width="200px" style="background-color: #073871; overflow-x:hidden">
      <h3 class="title">智慧养老平台</h3>
      <el-menu :default-openeds="false"
      background-color="#073871"
      text-color="#fff"
      style="border-right: none">
        <el-submenu index="1">
          <template slot="title"><i class="el-icon-message"></i>系统首页</template>
          <el-menu-item index="1-1">
            <router-link tag="div" to="/showye">系统首页</router-link>
          </el-menu-item>
        </el-submenu>
        <el-submenu index="2" v-if="this.user.yid!=3">
          <template slot="title"><i class="el-icon-menu"></i>设备管理</template>
          <el-menu-item index="2-1">
            <router-link tag="div" to="/leixing">设备类型</router-link>
          </el-menu-item>
          <el-menu-item index="2-2">
            <router-link tag="div" to="/guanli">设备管理</router-link>
          </el-menu-item>
        </el-submenu>
        <el-submenu index="3" v-if="this.user.yid!=3">
          <template slot="title"><i class="el-icon-setting"></i>服务管理</template>
          <el-menu-item index="3-1">
            <router-link tag="div" to="/jkgl">健康档案</router-link>
          </el-menu-item>
        </el-submenu>
        <el-submenu index="4" v-if="this.user.yid==3||this.user.yid==1">
          <template slot="title"><i class="el-icon-setting"></i>监控管理</template>
          <el-menu-item index="4-1">
            <router-link tag="div" to="/jkdw">监控定位</router-link>
          </el-menu-item>
          <el-menu-item index="4-2">
            <router-link tag="div" to="/yjqj">一键求助</router-link>
          </el-menu-item>
          <el-menu-item index="4-3">
            <router-link tag="div" to="/fdd">防跌倒监控</router-link>
          </el-menu-item>
          <el-menu-item index="4-5">
            <router-link tag="div" to="/yjjk">预警监控</router-link>
          </el-menu-item>
          <el-menu-item index="4-6">
            <router-link tag="div" to="/zjgl">足迹管理</router-link>
          </el-menu-item>
          <el-menu-item index="4-7">
            <router-link tag="div" to="/ceshi">自定义区域</router-link>
          </el-menu-item>
        </el-submenu>
        <el-submenu index="5" v-if="this.user.yid!=3">
          <template slot="title"><i class="el-icon-setting"></i>移动端管理</template>
          <el-menu-item index="5-1">
            <router-link tag="div" to="/yddgl">移动端用户管理</router-link>
          </el-menu-item>
          <el-menu-item index="5-2">
            <router-link tag="div" to="/yddqx">移动端角色权限</router-link>
          </el-menu-item>
          <el-menu-item index="5-3">
            <router-link tag="div" to="/message">消息设置</router-link>
          </el-menu-item>
        </el-submenu>
        <el-submenu index="6" v-if="this.user.yid==1&&this.user.yid!=2&&this.user.yid!=3" >
          <template slot="title"><i class="el-icon-setting"></i>系统管理</template>
          <el-menu-item index="6-1">
            <router-link tag="div" to="/SystemView">用户管理</router-link>
          </el-menu-item>
          <el-menu-item index="6-2">
            <router-link tag="div" to="/DepartmentView">部门管理</router-link>
          </el-menu-item>
          <el-menu-item index="6-3">
            <router-link tag="div" to="/RoleView">角色权限管理</router-link>
          </el-menu-item>
          <el-menu-item index="6-4">
            <router-link tag="div" to="/LogView">日志管理</router-link>
          </el-menu-item>
<!--          <el-menu-item index="6-5">-->
<!--            <router-link tag="div" to="/test">菜单管理</router-link>-->
<!--          </el-menu-item>-->
        </el-submenu>
      </el-menu>
    </el-aside>

    <el-container>
      <el-header style="text-align: right; font-size: 12px">
        <el-dropdown>
  <span class="el-dropdown-link">
    {{this.user.username}}<i class="el-icon-arrow-down el-icon--right"></i>
  </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item><span @click="setings()">资料设置</span></el-dropdown-item>
            <el-dropdown-item><span @click="update()">修改密码</span></el-dropdown-item>
            <el-dropdown-item><span @click="denglu()">登录记录</span></el-dropdown-item>
            <el-dropdown-item><span @click="exit()">退出系统</span></el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </el-header>

      <el-main>
        <router-view/>
      </el-main>

    </el-container>
  </el-container>
</template>

<style>
.el-header {
  background-color: #B3C0D1;
  //color: #333;
  line-height: 60px;
}

.el-aside {
  //color: #333;
}

.el-dropdown-link {
  cursor: pointer;
  color: #409EFF;
}
.el-icon-arrow-down {
  font-size: 12px;
}
.title {
  text-align: center;
  color: #fff;

  line-height: 50px;
  height: 40px;
  margin-top: 10px;

}

</style>

<script>
export default {
  data() {
    return {
      user:{},
    };
  },
  methods: {
    setings(){
      location.href="#/ziliao";
    },
    update(){
      location.href="#/update";
    },
    denglu(){
      location.href="#/log2View";
    },
    exit(){
      location.href="#/";
    },
  },
created() {
    this.user=JSON.parse(sessionStorage.getItem('userDB'));
    if (this.user==null){
      location.href="#/";
    }
}
};
</script>
